package com.study.agp.binding;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.study.agp.R;
import com.study.agp.databinding.ActivityDataBinding;

public class DataActivity extends AppCompatActivity {
    ActivityDataBinding binding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_data);

        binding.setBook(new DBook("第一行代码", "郭霖", 5));
        binding.setEventHandler(this);
    }

    public void onClickButton(View button) {
        Toast.makeText(this, "Button Clicked!", Toast.LENGTH_SHORT).show();
    }
}